Please refer to 'toydata.m' to see how to use this code.